﻿using BCEntity.OA.GeneralDatabaseOperation;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace BCData.OA.GeneralDatabaseOperation
{
    /// <summary>
    /// 通用数据库操作
    /// </summary>
    public interface IGeneralDatabasesOperationData
    {
        /// <summary>
        /// 获取所有允许访问的数据库名称列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<GeneralDatabaseOperationDatabaseNameEntity>> GetAllDatabaseName();
        /// <summary>
        /// 获取所有表名称列表
        /// </summary>
        /// <param name="databaseName">数据库名称</param>
        /// <returns></returns>
        Task<IEnumerable<GeneralDatabaseOperationTableNameEntity>> GetAllTableName(string databaseName);
        /// <summary>
        /// 获取所有列名称列表
        /// </summary>
        /// <param name="databaseName">数据库名称</param>
        /// <param name="tableName">表名称</param>
        /// <returns></returns>
        Task<IEnumerable<GeneralDatabaseOperationColumnNameEntity>> GetAllColumnName(string databaseName,string tableName);
        /// <summary>
        /// 获取所有数据列表
        /// </summary>
        /// <param name="databaseName">数据库名称</param>
        /// <param name="tableName">表名称</param>
        /// <returns></returns>
        Task<IEnumerable<Object>> GetTableDataList(string databaseName, string tableName);
        /// <summary>
        /// 获取表数据
        /// </summary>
        /// <param name="databaseName">数据库名称</param>
        /// <param name="tableName">表名称</param>
        /// <param name="columnNameList">列名称列表</param>
        /// <param name="wheres">查询条件参数列表</param>
        /// <param name="symbol">表达式符号</param>
        /// <param name="parameters">查询条件参数值列表</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <returns></returns>
        Task<IEnumerable<Object>> GetTableData(string databaseName, string tableName, List<string> columnNameList, List<string> wheres, List<string> symbol, List<Object> parameters, int pageIndex, int pageSize);
        
    }
}
